home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / overview / dave falkenburg's sprocket / preferencesdialogwindow.cp < prev    next >
Encoding:
Text File  |  2000-09-28  |  1.8 KB  |  61 lines

  1. /*
  2.     File:        PreferencesDialogWindow.cp
  3.  
  4.     Contains:    A simple dialog window recipe
  5.  
  6.     Written by: Dave Falkenburg    
  7.  
  8.     Copyright:    Copyright © 1993-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 8/19/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 11/12/94    DRF                Set default & cancel items as well as cursor tracking.
  21.                 9/9/94        DRF                Removed redundant #include.
  22.  
  23. */
  24.  
  25. #include "PreferencesDialogWindow.h"
  26.  
  27. TPreferencesDialogWindow::TPreferencesDialogWindow() : TDialogWindow(kPreferencesDialogTemplateID)
  28.     {
  29.     //    Because TDialogWindow::TDialogWindow has already created the dialog,
  30.     //    this is a great place to grab settings & setup the contents of the
  31.     //    dialog.
  32.     //
  33.     //    Of course, if you do this you probably want to mark the DLOG
  34.     //    as not initially visible, then call ShowWindow just before returning.
  35.     //
  36.     //    You should also setup UPPs for any user items in here, too. 
  37.  
  38.     //    Set up the default buttons
  39.     //    Isn’t it neat that these also work for modeless dialogs?
  40.     
  41.     SetDialogDefaultItem(fWindow,ok);
  42.     SetDialogCancelItem(fWindow,cancel);
  43.     SetDialogTracksCursor(fWindow,true);
  44.     }
  45.  
  46. void
  47. TPreferencesDialogWindow::ItemHit(short theItem)
  48.     {
  49.     switch (theItem)
  50.         {
  51.         case    ok:
  52.         case    cancel:
  53.             this->Close();
  54.             delete this;
  55.             break;
  56.             
  57.         default:
  58.             break;
  59.         }
  60.     }
  61.